package com.ssharing.controller;

import com.ssharing.entities.Order;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.Stream;

@RestController
@RequestMapping("/order")
public class OrderController {
    @GetMapping("/list/user/{userId}")
    public List<Order> getOrderListByUserId(@PathVariable String userId) {
        Order o1 = Order.builder().amount(new BigDecimal(123123)).orderId("1").paymentDateTime(LocalDateTime.now()).userId(userId).build();
        Order o2 = Order.builder().amount(new BigDecimal(123123)).orderId("2").paymentDateTime(LocalDateTime.now()).userId(userId).build();
        List<Order> collect = Stream.of(o1, o2).collect(Collectors.toList());
        return collect;
    }
}
